package com.nurese.controller;

import com.google.gson.Gson;
import com.nurese.Person;
import com.nurese.service.AdministratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class LoginController2 {

    @Autowired
    private AdministratorService administratorService;

    @GetMapping("/login2")
    public String login() {
        return "login2";
    }

    @PostMapping("/login2")
    @ResponseBody
    public String login(String username, String password, String captcha, HttpSession session) {
        System.out.println("/login2");

        Gson gs = new Gson();

        Person person = new Person();
        person.setId(1);
        person.setName("我是酱油");
        person.setAge(24);

       return gs.toJson(person);

    }
}
